Learn T-SQL Commands with Samples
Skip Navigation Links
Skip Navigation Links.
Expand DatabaseDatabase
Expand TableTable
Expand ViewView
Expand Stored ProcedureStored Procedure
Expand Data FilteringData Filtering
Expand Data GroupingData Grouping
Collapse JoinsJoins
Expand TriggerTrigger
Expand CursorCursor
Expand OperatorsOperators
Expand ConstraintsConstraints
Expand FunctionsFunctions
Expand Conditional ProcessingConditional Processing
Expand LoopingLooping
Expand Error HandlingError Handling
Expand v.IMP Queriesv.IMP Queries
Expand XMLXML
Expand Query PerformanceQuery Performance
Expand QueriesQueries
Expand NormalizationNormalization
Expand CreateCreate
     

Right Join

 
      
Capitals
Country Capital
India New Delhi
USA Washington
France Paris
Continents
Country Continent
India Asia
USA N.America
Italy Europe
      
---- Returns all the rows from the second Table, even if there are no matches in the first Table.
SELECT Capitals.*, Continents.Continent FROM Capitals RIGHT JOIN Continents ON Capitals.Country=Continents.Country
      
Output
Country Capital Continent
India New Delhi Asia
USA Washington N.America
NULL NULL Europe